<div class="bs-example">
    <!-- Button HTML (to Trigger Modal) -->
    <!--    <a href="#myModal" class="btn btn-lg btn-primary" data-toggle="modal">Launch Demo Modal</a>-->

    <!-- Modal HTML -->
    <div id="modalSantri" class="modal fade">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title">Pilih Santri</h4>
                </div>
                <div class="modal-body">
                    <form>
                        <input type="radio" class="radioBtnClass" name="numbers" value="1">Pilihan 1<br>
                        <input type="radio" class="radioBtnClass" name="numbers" value="2">Pilihan 2<br>
                        <input type="radio" class="radioBtnClass" name="numbers" value="3">Pilihan 3<br>              
                    </form>
                    <p>Do you want to save changes you made to document before closing?</p>
                    <p class="text-warning"><small>If you don't save, your changes will be lost.</small></p>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                    <a href="#" class="btn btn-primary" onclick="OKClicked ()">Pilih</a>
                </div>
            </div>
        </div>
    </div>
</div> 

<script type="text/javascript">
    function OKClicked (){
        //var myPopup = document.getElementById ("modalSantri");
        //var newtype = myPopup.options [myPopup.selectedIndex].text;
        if($("input[type='radio'].radioBtnClass").is(':checked')) {
            var selected_value =  $("input[type='radio'].radioBtnClass:checked").val();
            document.getElementById ('in_santri').value= selected_value;
        }
        $('#modalSantri').modal('hide');
    };
    $(function() {
        $(".radioBtnClass").change(function(){ 
            // bind a function to the change event
            if( $(this).is(":checked") ){ // check if the radio is checked
                var selected = $(this).val(); // retrieve the value
                document.getElementById ('in_santri').value= selected;
            }
        });
        $('#modalSantri').modal('hide');
    });
</script>